package by.averianov.discounta.datamodel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import by.averianov.discounta.datamodel.enums.CardStatus;

@Entity
public class Card extends AbstractEntity {

	// Need rebuild for any cards. But way?
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
	
	@Column
	@Enumerated(EnumType.ORDINAL)
	private CardStatus cardStatus;	
	@Column
	private Long cardDateCreate;
	@Column
	private Long cardDateStart;
	@Column
	private String activateCode;
	
	@ManyToOne(fetch = FetchType.EAGER, targetEntity = UserProfile.class)
	private UserProfile userEditor;

	@ManyToOne(fetch = FetchType.EAGER, targetEntity = CardType.class)
	private CardType cardType;
	
	@ManyToOne(fetch = FetchType.EAGER, targetEntity = UserProfile.class)
	private UserProfile userProfile;
		

	public Long getCardDateCreate() {
		return cardDateCreate;
	}

	public void setCardDateCreate(Long cardDateCreate) {
		this.cardDateCreate = cardDateCreate;
	}

	public CardStatus getCardStatus() {
		return cardStatus;
	}

	public void setCardStatus(CardStatus cardStatus) {
		this.cardStatus = cardStatus;
	}

	public void setUserEditor(UserProfile userEditor) {
		this.userEditor = userEditor;
	}

	public void setUserProfile(UserProfile userProfile) {
		this.userProfile = userProfile;
	}

	public Long getCardDateStart() {
		return cardDateStart;
	}

	public void setCardDateStart(Long cardDateStart) {
		this.cardDateStart = cardDateStart;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getActivateCode() {
		return activateCode;
	}

	public void setActivateCode(String activateCode) {
		this.activateCode = activateCode;
	}

	public CardType getCardType() {
		return cardType;
	}

	public void setCardType(CardType cardType) {
		this.cardType = cardType;
	}

	public UserProfile getUserProfile() {
		return userProfile;
	}

	public UserProfile getUserEditor() {
		return userEditor;
	}

	public Long getId() {
		return id;
	}

}
